package schoolWork.work02.BookBorrowingSystem;

public class Libsys {

    public static void main(String[] args) {
//创建图书对象
        Book abook1 = new Book("BOOK001", "C语言程序设计", 35, "在库");
        Book abook2 = new Book("BOOK002", "JAVA语言程序设计", 25, "在库");
//创建管理员对象
        Admin admin1 = new Admin("001", "周华");
//创建读者对象
        Reader reader1 = new Reader("STU001", "张兰", "软件工程");

//管理员录入新书
        admin1.addNewBook(abook1);
        admin1.addNewBook(abook2);

//管理员处理读者借书工作
        admin1.lendBook(reader1, abook1);
        admin1.lendBook(reader1, abook2);
//显示图书馆图书信息
        for (int i = 0; i < Books.bookList.size(); i++)
            Books.bookList.get(i).show();
//显示读书借阅信息
        for (int i = 0; i < BorrowOrder.borrowList.size(); i++)
            BorrowOrder.borrowList.get(i).show();

//管理员处理读者还书工作
        admin1.returnBook(reader1, abook1);

//显示还书后的图书信息和借阅信息
        System.out.println("还书后：");
        for (int i = 0; i < Books.bookList.size(); i++)
            Books.bookList.get(i).show();
        for (int i = 0; i < BorrowOrder.borrowList.size(); i++)
            BorrowOrder.borrowList.get(i).show();
//查询图书信息
        for (int i = 0; i < Books.bookList.size(); i++) {
            if (Books.bookList.get(i).getName().equals("C语言程序设计")) {
                Books.bookList.get(i).show();
            }
        }
    }
}
